<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/
use App\Entity\Member;
Route::get('/', function () {
  return view('product');
   // return Member::all();
});

Route::get('/product/category_id/{category_id}', 'View\CategoryController@toProduct');
Route::get('/product/product_id/{product_id}', 'View\CategoryController@toPdtContent');
Route::get('/register','View\MemberController@toRegister');//注册
Route::get('/login','View\MemberController@toLogin');//登录
Route::get('/category', 'View\CategoryController@toCategory');



//路由service组
Route::group(['prefix'=>'service'],function(){

    Route::post('validate_phone/send', 'Service\ValidateController@sendSMS');//发送短信
    Route::post('validate_email', 'Service\ValidateController@validateEmail');
    Route::get('validate_code/create','Service\ValidateController@create');//创建图形验证码
    Route::post('register','Service\MemberController@register');//注册
    Route::post('login','Service\MemberController@login');//登录
    Route::get('category/parent_id/{parent_id}','Service\CategoryController@getCategory');
    Route::get('cart/add/{product_id}','Service\CartController@addCart');
    Route::get('deleteCart','Service\CartController@deleteCart');

});

Route::group(['middleware'=>'check.login'],function (){
    Route::get('/cart','View\CartController@toCart');
    Route::get('/order_pay','View\OrderController@toOrderPay');


});